Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Documentation Audit changes #1008

Merged
merged 11 commits into from
Mar 16, 2021
Merged

docs: Documentation Audit changes #1008

merged 11 commits into from
Mar 16, 2021

Conversation

brandonlenz
Copy link
Contributor

@brandonlenz brandonlenz commented Mar 9, 2021

Summary

It was recently recommended to do an audit of our documentation. This PR includes the changes I recommend.

Additionally, we migrated from the now-deprecated storybook addon-info to addon-docs, however the parameters api for attaching component descriptions to storybook changed. This PR updates our stories to display the brief descriptions and, more importantly, source links to the original uswds components. ed171f9 For example:

image

Finally, while looking through storybook I was reminded that the documentation around our component props does not populate default values for optional props. This is solved by doing prop restructuring in the functional component signature rather than in the method body. 27f16c2 For example:

export const GovBanner = ({
    tld = '.gov',
    language = 'english',
    className,
    ...sectionProps
}: GovBannerProps & JSX.IntrinsicElements['section']): React.ReactElement => {
  // Rest of functional component logic/rendering
}

Instead of:

export const GovBanner = (
  props: GovBannerProps & JSX.IntrinsicElements['section']
): React.ReactElement => {
  const {
    tld = '.gov',
    language = 'english',
    className,
    ...sectionProps
  } = props
  // Rest of functional component logic/rendering
}

yielding:

image

How To Test

  • Mostly copy changes, so proofreading and double checking links would be the best way.
  • Unit tests and compilation help ensure confidence that prop destructuring changes didn't break components
  • Storybook changes can be seen in the PR storybook deployment.

@brandonlenz brandonlenz added the status: wip Work in progress - not ready for code review label Mar 9, 2021
@trussworks-infra-zz trussworks-infra-zz temporarily deployed to storybook March 9, 2021 15:38 Inactive
- Destruccuting props as args in functional component signatures allows storybook to infer default values of props
@trussworks-infra-zz
Copy link

trussworks-infra-zz commented Mar 9, 2021

Warnings
⚠️ This PR does not include changes to tests, even though it affects source code.

Generated by 🚫 dangerJS against 45ab9ae

@trussworks-infra-zz trussworks-infra-zz temporarily deployed to storybook March 9, 2021 22:50 Inactive
- Migration from addon-info to addon-docs involves parameter changes for component descriptions included in this commit
@trussworks-infra-zz trussworks-infra-zz temporarily deployed to storybook March 10, 2021 20:07 Inactive
@brandonlenz brandonlenz changed the title [WIP] docs: Documentation Audit changes docs: Documentation Audit changes Mar 10, 2021
@brandonlenz brandonlenz marked this pull request as ready for review March 10, 2021 20:08
@trussworks-infra-zz trussworks-infra-zz temporarily deployed to storybook March 10, 2021 20:11 Inactive
@brandonlenz brandonlenz removed the status: wip Work in progress - not ready for code review label Mar 10, 2021
suzubara
suzubara previously approved these changes Mar 15, 2021
Copy link
Contributor

@suzubara suzubara left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is awesome!! Thanks for taking on all this work 🎉

@brandonlenz
Copy link
Contributor Author

@suzubara Thanks for the ✅

I had to update from main, so it might require approval again. I also added the Link for GovBanner in 45ab9ae which I missed in the first pass.

@trussworks-infra-zz trussworks-infra-zz temporarily deployed to storybook March 15, 2021 19:59 Inactive
@suzubara suzubara self-requested a review March 16, 2021 14:34
@brandonlenz brandonlenz merged commit a8d267f into main Mar 16, 2021
@brandonlenz brandonlenz deleted the bl-documentation-audit branch March 16, 2021 15:06
This was referenced Mar 17, 2021
brandonlenz added a commit that referenced this pull request May 12, 2021
* Link to README

* Link to license

* Add FAQ about where to file issues

* Update Icon documentation

* Allow storybook to infer prop defaults

- Destructuring props as args in functional component signatures allows storybook to infer default values of props

* Show storybook descriptions on docs page

- Migration from addon-info to addon-docs involves parameter changes for component descriptions included in this commit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants